

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="正则基础元字符​                                   POSIX BRE 和 ERE 都支持的 meta 字符    字符 BRE&#x2F;ERE 模式含义    ^ BRE,ERE 锚定行或字符串的开始，如：‘^grep’  匹配所有以 grep 开头的行。BRE：仅仅在正则表达式结尾处具有特殊含义；ERE：在正则表达式任何地方都有特殊含义   $ BRE,ERE 锚定行">
<meta property="og:type" content="article">
<meta property="og:title" content="shell-正则表达式">
<meta property="og:url" content="http://example.com/2019/04/15/shell/shell-%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="正则基础元字符​                                   POSIX BRE 和 ERE 都支持的 meta 字符    字符 BRE&#x2F;ERE 模式含义    ^ BRE,ERE 锚定行或字符串的开始，如：‘^grep’  匹配所有以 grep 开头的行。BRE：仅仅在正则表达式结尾处具有特殊含义；ERE：在正则表达式任何地方都有特殊含义   $ BRE,ERE 锚定行">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2019-04-15T03:08:05.000Z">
<meta property="article:modified_time" content="2022-02-10T03:10:50.387Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="Linux">
<meta property="article:tag" content="Shell">
<meta name="twitter:card" content="summary_large_image">
  
  
  <title>shell-正则表达式 - Hexo</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.8.13","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>LZDF</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="shell-正则表达式">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2019-04-15 11:08" pubdate>
        2019年4月15日 上午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      3.1k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      26 分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">shell-正则表达式</h1>
            
            <div class="markdown-body">
              <h1 id="正则基础"><a href="#正则基础" class="headerlink" title="正则基础"></a>正则基础</h1><h2 id="元字符"><a href="#元字符" class="headerlink" title="元字符"></a>元字符</h2><p>​                                   <strong>POSIX BRE 和 ERE 都支持的 meta 字符</strong></p>
<table>
<thead>
<tr>
<th align="center">字符</th>
<th>BRE/ERE</th>
<th>模式含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">^</td>
<td>BRE,ERE</td>
<td>锚定行或字符串的开始，如：‘^grep’  匹配所有以 grep 开头的行。BRE：仅仅在正则表达式结尾处具有特殊含义；ERE：在正则表达式任何地方都有特殊含义</td>
</tr>
<tr>
<td align="center">$</td>
<td>BRE,ERE</td>
<td>锚定行或字符串的结束，如：‘grep$’ 匹配所有以 grep 结尾的行。BRE：仅仅在正则表达式结尾处具有特殊含义；ERE：在正则表达式任何地方都有特殊含义</td>
</tr>
<tr>
<td align="center">.</td>
<td>BRE,ERE</td>
<td>匹配一个非换行符的字符，如：‘gr.p’ 匹配 gr 后接一个任意字符，然后是 p</td>
</tr>
<tr>
<td align="center">*</td>
<td>BRE,ERE</td>
<td>匹配零个或多个先前字符。如：‘*grep’ 匹配所有一个或多个空格后紧跟 grep 的行。.*一起使用代表任意字符</td>
</tr>
<tr>
<td align="center">[…]</td>
<td>BRE,ERE</td>
<td>匹配中括号内任意一个字符。如果 <code>^</code> 符号位于方括号的开始，则不匹配括号内的任意字符。如：[^a-zA-Z] 不匹配 a-z和A-Z中任意字符</td>
</tr>
<tr>
<td align="center">\</td>
<td>BRE,ERE</td>
<td>用于打开或关闭后续字符的特殊含义。如：\(\)</td>
</tr>
</tbody></table>
<p><em>BRE：基本正则表达式；ERE扩展正则表达式</em></p>
<p>​                                        <strong>POSIX BRE 和 ERE 支持不同的 meta 字符</strong></p>
<table>
<thead>
<tr>
<th align="center">字符</th>
<th align="center">BRE/ERE</th>
<th>模式含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">\(\)</td>
<td align="center">BRE</td>
<td>标记匹配字符，这个元字符将\（和\）之间的模式存储在保留空间中，在后续的正则表达式中可以通过转义序列引用这些匹配的模式。如‘\(grep\).*\1’ 就匹配两个 grep 中间带有任意数目的字符，第二个 grep 使用 \1来引用。最多可以保存 9 个独立的模式，即从 \1 到 \9</td>
</tr>
<tr>
<td align="center">\n</td>
<td align="center">BRE</td>
<td>重复在 \（与\）内的第 n 个模式。n 为 1 到 9，n是数字</td>
</tr>
<tr>
<td align="center">x\{m,n\}</td>
<td align="center">BRE</td>
<td>区间表达式，匹配 x 字符出现的次数区间。<code>x\&#123;n\&#125;</code>是指 x 出现了 n 次；<code>x\&#123;m,\&#125;</code> 是指最少出现 m 次；<code>x\&#123;m,n\&#125;</code> 是指至少出现 m 次，至多出现 n 次</td>
</tr>
<tr>
<td align="center">x{m,n}</td>
<td align="center">ERE</td>
<td>和上一条一样，不过没有反斜杠</td>
</tr>
<tr>
<td align="center">+</td>
<td align="center">ERE</td>
<td>匹配前面正则表达式的一个或多个实例</td>
</tr>
<tr>
<td align="center">?</td>
<td align="center">ERE</td>
<td>匹配前面正则表达式的零个或一个实例</td>
</tr>
<tr>
<td align="center">&amp;#x7C</td>
<td align="center">ERE</td>
<td>匹配前面或后面的正则表达式</td>
</tr>
<tr>
<td align="center">()</td>
<td align="center">ERE</td>
<td>匹配用括号括起来的正则表达式群</td>
</tr>
</tbody></table>
<p>​                                             <strong>grep 程序支持的 meta 字符 plus</strong></p>
<table>
<thead>
<tr>
<th align="center">字符</th>
<th>模式含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">\&lt;</td>
<td>锚定单词的开始，如：‘\&lt;grep’ 匹配包含以 grep 开头的单词的行</td>
</tr>
<tr>
<td align="center">\&gt;</td>
<td>锚定单词的结束，如：‘grep\&gt;’ 匹配包含以 grep 结尾的单词的行</td>
</tr>
<tr>
<td align="center">\w</td>
<td>匹配文字和数字字符，也就是[A-Za-z0-9]，如：‘G\w*p’ 匹配以 G 后跟零个或多个文字或数字字符，然后是p</td>
</tr>
<tr>
<td align="center">\W</td>
<td>\w 的反置形式，匹配一个或多个非单词字符，如点号、句号等</td>
</tr>
<tr>
<td align="center">\b</td>
<td>单词锁定符，如 ‘\bgrep\b’ 值匹配 grep</td>
</tr>
</tbody></table>
<p><strong>正则表达式实例</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs bash">ls -l | grep <span class="hljs-string">&#x27;^d&#x27;</span> <span class="hljs-comment"># 通过管道过滤 ls -l 输出的内容，只显示以 d（文件为目录） 开头的行</span><br>grep <span class="hljs-string">&#x27;test&#x27;</span> d* <span class="hljs-comment"># 显示所有以 d 开头的文件中包含 test 的行</span><br>grep <span class="hljs-string">&#x27;test&#x27;</span> aa bb cc <span class="hljs-comment"># 显示在 aa，bb，cc，文件中匹配 test 的行</span><br>grep <span class="hljs-string">&#x27;[a-z]\&#123;5\&#125;&#x27;</span> aa <span class="hljs-comment"># 显示在 aa 文件中，所有包含至少有 5 个连续小写字符的字符串的行</span><br>grep <span class="hljs-string">&#x27;w\(es\)t.*\1&#x27;</span> aa <span class="hljs-comment"># 如果 west 被匹配，es 就被存储到内存中，并标记为1，然后搜索任意个字符(.*)，这个字符后面紧跟着另外一个es(\1)，找到就显示该行。如果egrep或grep -E，就不用“\”号进行转义，直接写成 &#x27;w(es)t.*\1&#x27; 就可以</span><br></code></pre></td></tr></table></figure>

<p>为了在不同国家的字符编码中保持一致，POSIX增加了特殊的字符类。</p>
<ul>
<li><p>POSIX 字符集</p>
<p>POSIX 字符集是以 <code>[:</code> 和 <code>:]</code> 括起来的字符。</p>
</li>
</ul>
<p>​                                                     <strong>POSIX 字符集</strong></p>
<table>
<thead>
<tr>
<th align="center">字符集</th>
<th align="left">匹配字符</th>
</tr>
</thead>
<tbody><tr>
<td align="center">[:alnum:]</td>
<td align="left">文字数字字符，等效于 A-Za-z0-9</td>
</tr>
<tr>
<td align="center">[:alpha:]</td>
<td align="left">文字字符</td>
</tr>
<tr>
<td align="center">[:blank:]</td>
<td align="left">空格（space）和定位（tab）字符</td>
</tr>
<tr>
<td align="center">[:digit:]</td>
<td align="left">数字字符</td>
</tr>
<tr>
<td align="center">[:graph:]</td>
<td align="left">非空字符（非空格、控制字符）</td>
</tr>
<tr>
<td align="center">[:lower:]</td>
<td align="left">小写字符</td>
</tr>
<tr>
<td align="center">[:cntrl:]</td>
<td align="left">控制字符</td>
</tr>
<tr>
<td align="center">[:print:]</td>
<td align="left">非空字符（包括空格）</td>
</tr>
<tr>
<td align="center">[:punct:]</td>
<td align="left">标点符号</td>
</tr>
<tr>
<td align="center">[:space:]</td>
<td align="left">所有空白符（新行、空格、制表符）</td>
</tr>
<tr>
<td align="center">[:upper]</td>
<td align="left">大写字符</td>
</tr>
<tr>
<td align="center">[:xdigit:]</td>
<td align="left">十六进制数字（0-9，a-f,A-F）</td>
</tr>
</tbody></table>
<ul>
<li><p>排序符号</p>
<p>排序符号将多个字符序列视为一个元素。使用 <code>[.</code> 和 <code>.]</code> 将字符组合括起来。例如，<code>[.cn.]</code> 表示 cn 字符序列，而单独的 c 或 n 都不行。</p>
</li>
<li><p>等价字符集</p>
<p>等价字符集表示应视为等值的一族字符，使用 <code>[=</code> 和 <code>=]</code> 将字符括起来。例如 e 和 é，在法语的 <code>local</code> 里，<code>[[=e=]]</code> 可能匹配 <code>e/ē/é/ě/è</code>。</p>
</li>
</ul>
<p>正则表达式允许将 POSIX 字符集与其他字符集混用，如 <code>[[:alpha:]]!</code>匹配任意一个英文字母或者感叹号（!）。</p>
<p><strong>一个 POSIX 方括号实例</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ cat test.txt<br><span class="hljs-built_in">test</span> grep | <span class="hljs-built_in">test</span> <br>grep <span class="hljs-string">&#x27;w(es)t.*\1&#x27;</span><br><span class="hljs-built_in">test</span> <span class="hljs-built_in">test</span> <span class="hljs-built_in">test</span> <span class="hljs-built_in">test</span><br>test_12321<br>123_test<br>$ grep -E <span class="hljs-string">&quot;[[:digit:]]_+&quot;</span> test.txt<br>test_12321<br></code></pre></td></tr></table></figure>

<h2 id="单个字符"><a href="#单个字符" class="headerlink" title="单个字符"></a>单个字符</h2><ul>
<li><p>一般字符</p>
<p>包含文字和数字字符、空白字符和标点符号字符。</p>
</li>
<li><p>转义的 meta 字符</p>
<p>使用反斜杠 <code>\</code>转义 meta 字符，<code>\\</code>转义反斜杠本身。</p>
</li>
<li><p>.（点好）字符</p>
<p>标识“任一字符”，一般不会单独使用</p>
</li>
<li><p>方括号表达式</p>
<p><code>[^...]</code> 取反，即不在方括号里面出现的任意字符；方括号表达式中，所有其他的 <code>meta</code> 字符都会数去其含义。例如 <code>[\.]</code> 匹配反斜杠和点号，而不是匹配句点。</p>
</li>
</ul>
<h2 id="运算符优先级"><a href="#运算符优先级" class="headerlink" title="运算符优先级"></a>运算符优先级</h2><p>​                                              <strong>BRE 的运算优先级</strong></p>
<table>
<thead>
<tr>
<th align="center">运算符</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">[…][==][::]</td>
<td>方括号符号</td>
</tr>
<tr>
<td align="center">\meta</td>
<td>转义的 meta 字符</td>
</tr>
<tr>
<td align="center">[]</td>
<td>方括号表达式</td>
</tr>
<tr>
<td align="center">\(\)\n</td>
<td>后向引用表达式</td>
</tr>
<tr>
<td align="center">*\{\}</td>
<td>区间表达式和型号表达式</td>
</tr>
<tr>
<td align="center">无符号</td>
<td>连续</td>
</tr>
<tr>
<td align="center">^$</td>
<td>锚点</td>
</tr>
</tbody></table>
<p>​                                             <strong>ERE 的运算优先级</strong></p>
<table>
<thead>
<tr>
<th align="center">运算符</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">[…][==][::]</td>
<td>方括号符号</td>
</tr>
<tr>
<td align="center">\meta</td>
<td>转义的 meta 字符</td>
</tr>
<tr>
<td align="center">[]</td>
<td>方括号表达式</td>
</tr>
<tr>
<td align="center">()</td>
<td>分组</td>
</tr>
<tr>
<td align="center">* + ? {}</td>
<td>重复前置的正则表达式</td>
</tr>
<tr>
<td align="center">无符号</td>
<td>连续</td>
</tr>
<tr>
<td align="center">^$</td>
<td>锚点</td>
</tr>
<tr>
<td align="center">&amp;#x7C</td>
<td>交替</td>
</tr>
</tbody></table>
<p><em>ERE运算优先级中多出两个运算符，分别是分组和交替</em></p>
<h1 id="正则表达式的应用"><a href="#正则表达式的应用" class="headerlink" title="正则表达式的应用"></a>正则表达式的应用</h1><p><strong>单词的开头结尾匹配</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ <span class="hljs-built_in">echo</span> <span class="hljs-string">&#x27;this is a word.&#x27;</span> | grep <span class="hljs-string">&quot;\&lt;word\&gt;&quot;</span> <span class="hljs-comment"># 匹配单词开头+word+单词结尾</span><br>$ <span class="hljs-built_in">echo</span> <span class="hljs-string">&#x27;these are words.&#x27;</span> | grep <span class="hljs-string">&quot;\&lt;word&quot;</span> <span class="hljs-comment"># 匹配单词开头+word</span><br>$ <span class="hljs-built_in">echo</span> <span class="hljs-string">&#x27;these are words.&#x27;</span> | grep <span class="hljs-string">&quot;\&lt;word\&gt;&quot;</span> <span class="hljs-comment"># 匹配单词开头+word+单词结尾，匹配失败</span><br>$ <span class="hljs-built_in">echo</span> <span class="hljs-string">&#x27;these are words.&#x27;</span> | grep <span class="hljs-string">&quot;\&lt;are\&gt;&quot;</span> <span class="hljs-comment"># 匹配单词开头+are+单词结尾</span><br></code></pre></td></tr></table></figure>

<p>​                                      <strong>GNU 支持的额外正则表达式运算符</strong></p>
<table>
<thead>
<tr>
<th align="center">运算符</th>
<th>含义</th>
</tr>
</thead>
<tbody><tr>
<td align="center">\w</td>
<td>匹配任何单词组成字符，等同于 <code>[[:alnum:]_]</code></td>
</tr>
<tr>
<td align="center">\W</td>
<td>匹配任何非单词组成字符，等同于 <code>[^[:alnum:]_]</code></td>
</tr>
<tr>
<td align="center">\&lt;\&gt;</td>
<td>匹配单词的起始与结尾</td>
</tr>
<tr>
<td align="center">\b</td>
<td>匹配单词的起始或结尾处所找到的空字符串，这是\&lt;与\&gt;的结合</td>
</tr>
<tr>
<td align="center">\B</td>
<td>匹配两个单词组成字符之间的空字符串</td>
</tr>
<tr>
<td align="center">\‘\`</td>
<td>分别匹配 emacs 缓冲区的开始与结尾。GNU程序通常将它们视为与^及$同义</td>
</tr>
</tbody></table>
<p>…</p>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/Shell/">Shell</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/Linux/">Linux</a>
                    
                      <a class="hover-with-bg" href="/tags/Shell/">Shell</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2019/04/15/php/PHP-%E5%AD%90%E7%B1%BB%E9%87%8D%E5%86%99%E7%88%B6%E7%B1%BB%E5%B1%9E%E6%80%A7%E9%97%AE%E9%A2%98/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">PHP-子类重写父类属性问题</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2019/04/01/shell/shell-%E7%BC%96%E7%A8%8B%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%85%83%E7%B4%A0/">
                        <span class="hidden-mobile">shell-编程的基本元素</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
